package cn.school.test;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import cn.school.dao.InStudentDao;
import cn.school.eneity.Student;
import cn.school.util.MyBatisUtil;

public class Test {
	public static void main(String[] args) {
//		SqlSession session = MyBatisUtil.getSession();
//		InStudentDao mapper = session.getMapper(InStudentDao.class);
//		List<Student> list = mapper.selectALL(1);
//		for (Student s : list) {
//			System.out.println(s);
//		}
//		MyBatisUtil.close(session);
//
//		SqlSession session2 = MyBatisUtil.getSession();
//		InStudentDao mapper2 = session2.getMapper(InStudentDao.class);
//		List<Student> list1 = mapper2.select();
//		for (Student s1 : list1) {
//			System.out.println(s1);
//		}
//		MyBatisUtil.close(session2);

//		SqlSession session3 = MyBatisUtil.getSession();
//		InStudentDao mapper3 = session3.getMapper(InStudentDao.class);
//		Student s = new Student("小杨", "男", "15528415", "186585295", "186528", 3L, Date.valueOf("2017-10-11"), "合肥",
//				Date.valueOf("1999-10-14"), "瑶海区", "12518");
//		System.out.println(s);
//		int r = mapper3.add(s);
//		System.out.println(r > 0 ? "加入成功" : "加入失败");
//		session3.commit();
//		MyBatisUtil.close(session3);

//		SqlSession session4 = MyBatisUtil.getSession();
//		InStudentDao mapper4 = session4.getMapper(InStudentDao.class);
//		Student s = new Student();
//		s.setSname("肖大爷");
//		s.setSex("男");
//		s.setPass("15501");
//		s.setStuno(5L);
//		int r = mapper4.update(s);
//		System.out.println(r > 0 ? "修改成功" : "修改失败");
//		session4.commit();
//		MyBatisUtil.close(session4);

//		SqlSession session5 = MyBatisUtil.getSession();
//		InStudentDao mapper5 = session5.getMapper(InStudentDao.class);
//		Student s = new Student();
//		int r = mapper5.delete(232L);
//		System.out.println(r > 0 ? "删除成功" : "删除失败");
//		session5.commit();
//		MyBatisUtil.close(session5);

		SqlSession session6 = MyBatisUtil.getSession();
		InStudentDao mapper6 = session6.getMapper(InStudentDao.class);
		List<Student> list = mapper6.selectmohu("丁", "1", "1");
		for (Student s1 : list) {
			System.out.println(s1);
		}

//		SqlSession session7 = MyBatisUtil.getSession();
//		InStudentDao mapper7 = session7.getMapper(InStudentDao.class);
//		List<Student> list = mapper7.selectass();
//		for (Student s : list) {
//			System.out.println(s);
//		}
	}
}
